package com.fmy.jurisdiction.modular.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

import com.fmy.jurisdiction.core.commons.status.PermissionType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;

/**
 * <p>
 * 权限表
 * </p>
 *
 * @author Mr.fmy
 * @since 2019-09-16
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class AdminPermission implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 权限名称
     */
    private String name;

    /**
     * 权限编码
     */
    @NotBlank(message = "请输入权限编码")
    private String code;

    /**
     * 父权限编码
     */
    @NotBlank(message = "请选择父权限")
    private String pcode;

    /**
     * 所有父权限编码
     */
    private String pcodes;

    /**
     * url 或 前端路由
     */
    private String url;

    /**
     * 图标
     */
    private String icon;

    /**
     * 类型 1菜单 2按钮权限
     */
    private PermissionType type;

    /**
     * 层级
     */
    private Integer level;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 创建人
     */
    private Integer createUser;

    /**
     * 修改时间
     */
    private Date modifyTime;

    /**
     * 修改人
     */
    private Integer modifyUser;

    /**
     * 排序
     */
    private Integer sort;


    public static final String ID = "id";

    public static final String NAME = "name";

    public static final String CODE = "code";

    public static final String PCODE = "pcode";

    public static final String PCODES = "pcodes";

    public static final String URL = "url";

    public static final String ICON = "icon";

    public static final String TYPE = "type";

    public static final String LEVEL = "level";

    public static final String CREATE_TIME = "create_time";

    public static final String CREATE_USER = "create_user";

    public static final String MODIFY_TIME = "modify_time";

    public static final String MODIFY_USER = "modify_user";

    public static final String SORT = "sort";

    public static final String ID_FIELD = "id";

    public static final String NAME_FIELD = "name";

    public static final String CODE_FIELD = "code";

    public static final String PCODE_FIELD = "pcode";

    public static final String PCODES_FIELD = "pcodes";

    public static final String URL_FIELD = "url";

    public static final String ICON_FIELD = "icon";

    public static final String TYPE_FIELD = "type";

    public static final String LEVEL_FIELD = "level";

    public static final String CREATE_TIME_FIELD = "createTime";

    public static final String CREATE_USER_FIELD = "createUser";

    public static final String MODIFY_TIME_FIELD = "modifyTime";

    public static final String MODIFY_USER_FIELD = "modifyUser";

    public static final String SORT_FIELD = "sort";

}
